<template>
  <div>
    <!--编写页面静态部分，即view部分-->
    <el-form :model="params">
      <el-select v-model="params.siteId" placeholder="请选择站点">
        <el-option
          v-for="item in siteList"
          :key="item.siteId"
          :label="item.siteName"
          :value="item.siteId">
        </el-option>
      </el-select>
      <el-input v-model="params.pageAliase" style="width:100px" placeholder="请输入内容"></el-input>
      <el-button type="primary" size="medium" v-on:click="queryCms()">查询</el-button>
    </el-form>
    <el-table
      :data="list"
      stripe
      style="width: 100%">
      <el-table-column type="index" width="60">
      </el-table-column>
      <el-table-column prop="pageName" label="页面名称" width="120">
      </el-table-column>
      <el-table-column prop="pageAliase" label="别名" width="120">
      </el-table-column>
      <el-table-column prop="pageType" label="页面类型" width="150">
      </el-table-column>
      <el-table-column prop="pageWebPath" label="访问路径" width="250">
      </el-table-column>
      <el-table-column prop="pagePhysicalPath" label="物理路径" width="250">  </el-table-column>
      <el-table-column prop="pageCreateTime" label="创建时间" width="180" >  </el-table-column>
    </el-table>
    <el-pagination
      background
      layout="prev, pager, next"
      :total="total"
      :page-size="params.pageSize"
      :current-page="params.currentPage"
      @current-change="pageChange"
      style="float:right"
    >
    </el-pagination>
  </div>


</template>
<script>
  import * as hedaCms from './../api/cms';
  /*编写页面静态部分，即model及vm部分。*/
  export default {

    data() {

      return {
        total:0,
        params:{
          pageSize:10,
          currentPage:1,
          siteId:'',
          pageAliase:''
        },
        "list": [],
        siteList: []

      }
    },
    methods:{

      queryCms:function() {

        hedaCms.cms_page_list(this.params.currentPage,this.params.pageSize,this.params).then((res)=>{
         // alert(1);
          this.list=res.queryResult.list;
          this.total=res.queryResult.total;
        })
        //alert(1);
      }
      ,
      pageChange:function (val) {
        this.params.currentPage = val;
        //alert(val);
        //console.log(`当前页=============: ${val}`);
        this.queryCms();
      }

    },
    created(){
      this.queryCms();
      //获取站点列表信息
      //初始化站点列表
      this.siteList  =  [
        {
          siteId:'5a751fab6abb5044e0d19ea1',
          siteName:'门户主站'
        },
        {
          siteId:'102',
          siteName:'测试站'
        }
      ]
    }
  }
</script>
<style>
  /*编写页面样式，不是必须*/
</style>
